#include <cstring>
#include <fstream>
#include <iostream>
#include <algorithm>
#include "ti.h"
#include "tplate.h"

using namespace std;

void read_image_cont(train_grid_cont * ti, char *file)
{
    string type;
    int tmp;
    int height;                    // When in 2D, the height is always 1;
    fstream fs;
    fs.open(file);
    fs >> ti->width;
    fs >> ti->length;
    fs >> height;
    fs >> tmp;
    fs >> type;
    int size = (ti->length) * (ti->width) * height;
    ti->data = new float[size];
    for (int i = 0; i < size; i++)
    {
        fs >> (ti->data)[i];
    }
    fs.close();
}
